#include "mystyleditemdelegate.h"

myStyledItemDelegate::myStyledItemDelegate(QObject *parent) : QStyledItemDelegate(parent)
{

}

void myStyledItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    QVariant ret = index.data();
    qDebug()<<index.data()<<endl;
    if(ret == "名字")
    {
        QImage image;
        if(image.load("e:/3.png") == false)
        {
            qDebug()<<"图片加载失败"<<endl;
        }
        QRect r(option.rect.left()+option.rect.width()/2 - 30,option.rect.top(),66,54);
        painter->drawImage(r,image);

    }
    else if(ret == "密码")
    {

    }

}
